package Y2024.M12.D3;

import java.io.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-12-03
 * Time: 9:59
 */
public class Main {
    public static void main(String[] args) throws IOException {
        File file=new File("F:/1.dat");
        FileOutputStream fos=new FileOutputStream(file,true);
        DataOutputStream output=new DataOutputStream(fos);
        Scanner scanner=new Scanner(System.in);
        int n=0;
        while ((n=scanner.nextInt())!=0){
            output.writeInt(n);
        }
        scanner.close();
        output.close();
        fos.close();

        DataInputStream dis=new DataInputStream(new FileInputStream(file));
        int sum=0;
        while (dis.available()!=0){
            int num= dis.readInt();
            sum+=num;
        }
        dis.close();
        System.out.println(sum);
    }
}
